import Main;
import nme.Assets;


class ApplicationMain {
	
	static var mPreloader:NMEPreloader;

	public static function main () {
		
		var call_real = true;
		
		
		var loaded:Int = nme.Lib.current.loaderInfo.bytesLoaded;
		var total:Int = nme.Lib.current.loaderInfo.bytesTotal;
		
		if (loaded < total || true) /* Always wait for event */ {
			
			call_real = false;
			mPreloader = new NMEPreloader();
			nme.Lib.current.addChild(mPreloader);
			mPreloader.onInit();
			mPreloader.onUpdate(loaded,total);
			nme.Lib.current.addEventListener (nme.events.Event.ENTER_FRAME, onEnter);
			
		}
		
		
		if (call_real)
			Main.main();
	}

	static function onEnter (_) {
		
		var loaded:Int = nme.Lib.current.loaderInfo.bytesLoaded;
		var total:Int = nme.Lib.current.loaderInfo.bytesTotal;
		mPreloader.onUpdate(loaded,total);
		
		if (loaded >= total) {
			
			mPreloader.onLoaded();
			nme.Lib.current.removeEventListener(nme.events.Event.ENTER_FRAME, onEnter);
			nme.Lib.current.removeChild(mPreloader);
			mPreloader = null;
			
			Main.main ();
			
		}
		
	}

	public static function getAsset (inName:String):Dynamic {
		
		
		if (inName=="assets/VeraSeBd.ttf.hash")
			 
            return Assets.getBytes ("assets/VeraSeBd.ttf.hash");
         
		
		if (inName=="assets/Next.png")
			 
            return Assets.getBitmapData ("assets/Next.png");
         
		
		if (inName=="assets/VeraSeBd.ttf")
			 
			 return Assets.getFont ("assets/VeraSeBd.ttf");
         
		
		if (inName=="assets/Cardboard_Background.png")
			 
            return Assets.getBitmapData ("assets/Cardboard_Background.png");
         
		
		if (inName=="assets/PauseMenu.png")
			 
            return Assets.getBitmapData ("assets/PauseMenu.png");
         
		
		if (inName=="assets/TileSheet.png")
			 
            return Assets.getBitmapData ("assets/TileSheet.png");
         
		
		if (inName=="assets/MainMenu.png")
			 
            return Assets.getBitmapData ("assets/MainMenu.png");
         
		
		if (inName=="assets/audioMute.png")
			 
            return Assets.getBitmapData ("assets/audioMute.png");
         
		
		if (inName=="assets/BLAAMMute.png")
			 
            return Assets.getBitmapData ("assets/BLAAMMute.png");
         
		
		if (inName=="assets/KongLoaderSheet.png")
			 
            return Assets.getBitmapData ("assets/KongLoaderSheet.png");
         
		
		if (inName=="assets/Prev.png")
			 
            return Assets.getBitmapData ("assets/Prev.png");
         
		
		if (inName=="assets/Back.png")
			 
            return Assets.getBitmapData ("assets/Back.png");
         
		
		if (inName=="assets/audio.png")
			 
            return Assets.getBitmapData ("assets/audio.png");
         
		
		if (inName=="assets/Virtutes Instrumenti.mp3")
			 
            return Assets.getSound ("assets/Virtutes Instrumenti.mp3");
		 
		
		if (inName=="assets/VeraSe.ttf.hash")
			 
            return Assets.getBytes ("assets/VeraSe.ttf.hash");
         
		
		if (inName=="assets/TextBackground.png")
			 
            return Assets.getBitmapData ("assets/TextBackground.png");
         
		
		if (inName=="assets/MachineGun.png")
			 
            return Assets.getBitmapData ("assets/MachineGun.png");
         
		
		if (inName=="assets/Background.png")
			 
            return Assets.getBitmapData ("assets/Background.png");
         
		
		if (inName=="assets/icon.png")
			 
            return Assets.getBitmapData ("assets/icon.png");
         
		
		if (inName=="assets/VeraSe.ttf")
			 
			 return Assets.getFont ("assets/VeraSe.ttf");
         
		
		if (inName=="assets/BLAAM.png")
			 
            return Assets.getBitmapData ("assets/BLAAM.png");
         
		
		
		return null;
		
	}
	
}



	
		class NME_assets_verasebd_ttf_hash extends nme.utils.ByteArray { }
	

	
		class NME_assets_next_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_verasebd_ttf extends nme.text.Font { }
	

	
		class NME_assets_cardboard_background_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_pausemenu_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_tilesheet_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_mainmenu_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_audiomute_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_blaammute_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_kongloadersheet_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_prev_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_back_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_audio_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_virtutes_instrumenti_mp3 extends nme.media.Sound { }
	

	
		class NME_assets_verase_ttf_hash extends nme.utils.ByteArray { }
	

	
		class NME_assets_textbackground_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_machinegun_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_background_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_icon_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_verase_ttf extends nme.text.Font { }
	

	
		class NME_assets_blaam_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	
